<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>mousewheelhandler_test.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="local_closure_goog_events_mousewheelhandler_test.js.html">mousewheelhandler_test.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2009 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>goog.provide(&#39;goog.events.MouseWheelHandlerTest&#39;);
<a name="line16"></a>goog.setTestOnly(&#39;goog.events.MouseWheelHandlerTest&#39;);
<a name="line17"></a>
<a name="line18"></a>goog.require(&#39;goog.dom&#39;);
<a name="line19"></a>goog.require(&#39;goog.events&#39;);
<a name="line20"></a>goog.require(&#39;goog.events.BrowserEvent&#39;);
<a name="line21"></a>goog.require(&#39;goog.events.MouseWheelEvent&#39;);
<a name="line22"></a>goog.require(&#39;goog.events.MouseWheelHandler&#39;);
<a name="line23"></a>goog.require(&#39;goog.functions&#39;);
<a name="line24"></a>goog.require(&#39;goog.string&#39;);
<a name="line25"></a>goog.require(&#39;goog.testing.PropertyReplacer&#39;);
<a name="line26"></a>goog.require(&#39;goog.testing.events&#39;);
<a name="line27"></a>goog.require(&#39;goog.testing.jsunit&#39;);
<a name="line28"></a>goog.require(&#39;goog.userAgent&#39;);
<a name="line29"></a>
<a name="line30"></a>var log;
<a name="line31"></a>var stubs = new goog.testing.PropertyReplacer();
<a name="line32"></a>
<a name="line33"></a>var DEFAULT_TYPE = &#39;mousewheel&#39;;
<a name="line34"></a>var GECKO_TYPE = &#39;DOMMouseScroll&#39;;
<a name="line35"></a>
<a name="line36"></a>var HORIZONTAL = &#39;h&#39;;
<a name="line37"></a>var VERTICAL = &#39;v&#39;;
<a name="line38"></a>
<a name="line39"></a>var mouseWheelEvent;
<a name="line40"></a>var mouseWheelEventRtl;
<a name="line41"></a>var mouseWheelHandler;
<a name="line42"></a>var mouseWheelHandlerRtl;
<a name="line43"></a>
<a name="line44"></a>function setUpPage() {
<a name="line45"></a>  log = goog.dom.getElement(&#39;log&#39;);
<a name="line46"></a>}
<a name="line47"></a>
<a name="line48"></a>function setUp() {
<a name="line49"></a>  stubs.remove(goog, &#39;userAgent&#39;);
<a name="line50"></a>}
<a name="line51"></a>
<a name="line52"></a>function tearDown() {
<a name="line53"></a>  stubs.reset();
<a name="line54"></a>  goog.dispose(mouseWheelHandler);
<a name="line55"></a>  goog.dispose(mouseWheelHandlerRtl);
<a name="line56"></a>  mouseWheelHandlerRtl = null;
<a name="line57"></a>  mouseWheelHandler = null;
<a name="line58"></a>  mouseWheelEvent = null;
<a name="line59"></a>  mouseWheelEventRtl = null;
<a name="line60"></a>}
<a name="line61"></a>
<a name="line62"></a>function tearDownPage() {
<a name="line63"></a>  // Create interactive demo.
<a name="line64"></a>  mouseWheelHandler = new goog.events.MouseWheelHandler(document.body);
<a name="line65"></a>
<a name="line66"></a>  goog.events.listen(mouseWheelHandler,
<a name="line67"></a>      goog.events.MouseWheelHandler.EventType.MOUSEWHEEL,
<a name="line68"></a>      function(e) {
<a name="line69"></a>        log.innerHTML += goog.string.subs(&#39;&lt;br /&gt;(deltaX, deltaY): (%s, %s)&#39;,
<a name="line70"></a>            e.deltaX, e.deltaY);
<a name="line71"></a>      });
<a name="line72"></a>}
<a name="line73"></a>
<a name="line74"></a>function testIeStyleMouseWheel() {
<a name="line75"></a>  goog.userAgent = {
<a name="line76"></a>    OPERA: false,
<a name="line77"></a>    IE: true,
<a name="line78"></a>    GECKO: false,
<a name="line79"></a>    CAMINO: false,
<a name="line80"></a>    WEBKIT: false
<a name="line81"></a>  };
<a name="line82"></a>
<a name="line83"></a>  createHandlerAndListen();
<a name="line84"></a>
<a name="line85"></a>  // Non-gecko, non-webkit events get wheelDelta divided by -40 to get detail.
<a name="line86"></a>  handleEvent(createFakeMouseWheelEvent(DEFAULT_TYPE, 120));
<a name="line87"></a>  assertMouseWheelEvent(-3, 0, -3);
<a name="line88"></a>
<a name="line89"></a>  handleEvent(createFakeMouseWheelEvent(DEFAULT_TYPE, -120));
<a name="line90"></a>  assertMouseWheelEvent(3, 0, 3);
<a name="line91"></a>
<a name="line92"></a>  handleEvent(createFakeMouseWheelEvent(DEFAULT_TYPE, 1200));
<a name="line93"></a>  assertMouseWheelEvent(-30, 0, -30);
<a name="line94"></a>}
<a name="line95"></a>
<a name="line96"></a>function testNullBody() {
<a name="line97"></a>  goog.userAgent = {
<a name="line98"></a>    OPERA: false,
<a name="line99"></a>    IE: true,
<a name="line100"></a>    GECKO: false,
<a name="line101"></a>    CAMINO: false,
<a name="line102"></a>    WEBKIT: false
<a name="line103"></a>  };
<a name="line104"></a>  var documentObjectWithNoBody = { };
<a name="line105"></a>  goog.testing.events.mixinListenable(documentObjectWithNoBody);
<a name="line106"></a>  mouseWheelHandler =
<a name="line107"></a>      new goog.events.MouseWheelHandler(documentObjectWithNoBody);
<a name="line108"></a>}
<a name="line109"></a>
<a name="line110"></a>function testGeckoStyleMouseWheel() {
<a name="line111"></a>  goog.userAgent = {
<a name="line112"></a>    OPERA: false,
<a name="line113"></a>    IE: false,
<a name="line114"></a>    GECKO: true,
<a name="line115"></a>    CAMINO: false,
<a name="line116"></a>    WEBKIT: false
<a name="line117"></a>  };
<a name="line118"></a>
<a name="line119"></a>  createHandlerAndListen();
<a name="line120"></a>
<a name="line121"></a>  handleEvent(createFakeMouseWheelEvent(GECKO_TYPE, null, 3));
<a name="line122"></a>  assertMouseWheelEvent(3, 0, 3);
<a name="line123"></a>
<a name="line124"></a>  handleEvent(createFakeMouseWheelEvent(GECKO_TYPE, null, -12));
<a name="line125"></a>  assertMouseWheelEvent(-12, 0, -12);
<a name="line126"></a>
<a name="line127"></a>  // Really big values should get truncated to +-3.
<a name="line128"></a>  handleEvent(createFakeMouseWheelEvent(GECKO_TYPE, null, 1200));
<a name="line129"></a>  assertMouseWheelEvent(3, 0, 3);
<a name="line130"></a>
<a name="line131"></a>  handleEvent(createFakeMouseWheelEvent(GECKO_TYPE, null, -1200));
<a name="line132"></a>  assertMouseWheelEvent(-3, 0, -3);
<a name="line133"></a>
<a name="line134"></a>  // Test scrolling with the additional axis property.
<a name="line135"></a>  handleEvent(createFakeMouseWheelEvent(GECKO_TYPE, null, 3, VERTICAL));
<a name="line136"></a>  assertMouseWheelEvent(3, 0, 3);
<a name="line137"></a>
<a name="line138"></a>  handleEvent(createFakeMouseWheelEvent(GECKO_TYPE, null, 3, HORIZONTAL));
<a name="line139"></a>  assertMouseWheelEvent(3, 3, 0);
<a name="line140"></a>
<a name="line141"></a>  handleEvent(createFakeMouseWheelEvent(GECKO_TYPE, null, -3, HORIZONTAL));
<a name="line142"></a>  assertMouseWheelEvent(-3, -3, 0);
<a name="line143"></a>}
<a name="line144"></a>
<a name="line145"></a>function testWebkitStyleMouseWheel_ieStyle() {
<a name="line146"></a>  goog.userAgent = {
<a name="line147"></a>    OPERA: false,
<a name="line148"></a>    IE: false,
<a name="line149"></a>    GECKO: false,
<a name="line150"></a>    CAMINO: false,
<a name="line151"></a>    WEBKIT: true,
<a name="line152"></a>    WINDOWS: true
<a name="line153"></a>  };
<a name="line154"></a>
<a name="line155"></a>  createHandlerAndListen();
<a name="line156"></a>
<a name="line157"></a>  // IE-style Webkit events get wheelDelta divided by -40 to get detail.
<a name="line158"></a>  handleEvent(createFakeWebkitMouseWheelEvent(-40, 0));
<a name="line159"></a>  assertMouseWheelEvent(1, 1, 0);
<a name="line160"></a>
<a name="line161"></a>  handleEvent(createFakeWebkitMouseWheelEvent(120, 0));
<a name="line162"></a>  assertMouseWheelEvent(-3, -3, 0);
<a name="line163"></a>
<a name="line164"></a>  handleEvent(createFakeWebkitMouseWheelEvent(0, 120));
<a name="line165"></a>  assertMouseWheelEvent(-3, 0, -3);
<a name="line166"></a>
<a name="line167"></a>  handleEvent(createFakeWebkitMouseWheelEvent(0, -40));
<a name="line168"></a>  assertMouseWheelEvent(1, 0, 1);
<a name="line169"></a>
<a name="line170"></a>  handleEvent(createFakeWebkitMouseWheelEvent(80, -40));
<a name="line171"></a>  assertMouseWheelEvent(-2, -2, 1);
<a name="line172"></a>}
<a name="line173"></a>
<a name="line174"></a>function testWebkitStyleMouseWheel_ieStyleOnLinux() {
<a name="line175"></a>  goog.userAgent = {
<a name="line176"></a>    OPERA: false,
<a name="line177"></a>    IE: false,
<a name="line178"></a>    GECKO: false,
<a name="line179"></a>    CAMINO: false,
<a name="line180"></a>    WEBKIT: true,
<a name="line181"></a>    WINDOWS: false,
<a name="line182"></a>    LINUX: true
<a name="line183"></a>  };
<a name="line184"></a>  runWebKitContinousAndDiscreteEventsTest();
<a name="line185"></a>}
<a name="line186"></a>
<a name="line187"></a>function testWebkitStyleMouseWheel_ieStyleOnMac() {
<a name="line188"></a>  goog.userAgent = {
<a name="line189"></a>    OPERA: false,
<a name="line190"></a>    IE: false,
<a name="line191"></a>    GECKO: false,
<a name="line192"></a>    CAMINO: false,
<a name="line193"></a>    WEBKIT: true,
<a name="line194"></a>    WINDOWS: false,
<a name="line195"></a>    MAC: true
<a name="line196"></a>  };
<a name="line197"></a>  runWebKitContinousAndDiscreteEventsTest();
<a name="line198"></a>}
<a name="line199"></a>
<a name="line200"></a>function runWebKitContinousAndDiscreteEventsTest() {
<a name="line201"></a>  goog.userAgent.isVersionOrHigher = goog.functions.TRUE;
<a name="line202"></a>
<a name="line203"></a>  createHandlerAndListen();
<a name="line204"></a>
<a name="line205"></a>  // IE-style wheel events.
<a name="line206"></a>  handleEvent(createFakeWebkitMouseWheelEvent(0, -40));
<a name="line207"></a>  assertMouseWheelEvent(1, 0, 1);
<a name="line208"></a>
<a name="line209"></a>  handleEvent(createFakeWebkitMouseWheelEvent(80, -40));
<a name="line210"></a>  assertMouseWheelEvent(-2, -2, 1);
<a name="line211"></a>
<a name="line212"></a>  // Even in Webkit versions that usually behave in IE style, sometimes wheel
<a name="line213"></a>  // events don&#39;t behave; this has been observed for instance with Macbook
<a name="line214"></a>  // and Chrome OS touchpads in Webkit 534.10+.
<a name="line215"></a>  handleEvent(createFakeWebkitMouseWheelEvent(-3, 5));
<a name="line216"></a>  assertMouseWheelEvent(-5, 3, -5);
<a name="line217"></a>
<a name="line218"></a>  handleEvent(createFakeWebkitMouseWheelEvent(4, -7));
<a name="line219"></a>  assertMouseWheelEvent(7, -4, 7);
<a name="line220"></a>}
<a name="line221"></a>
<a name="line222"></a>function testWebkitStyleMouseWheel_nonIeStyle() {
<a name="line223"></a>  goog.userAgent = {
<a name="line224"></a>    OPERA: false,
<a name="line225"></a>    IE: false,
<a name="line226"></a>    GECKO: false,
<a name="line227"></a>    CAMINO: false,
<a name="line228"></a>    WEBKIT: true,
<a name="line229"></a>    WINDOWS: false
<a name="line230"></a>  };
<a name="line231"></a>
<a name="line232"></a>  goog.userAgent.isVersionOrHigher = goog.functions.FALSE;
<a name="line233"></a>
<a name="line234"></a>  createHandlerAndListen();
<a name="line235"></a>
<a name="line236"></a>  // non-IE-style Webkit events do not get wheelDelta scaled
<a name="line237"></a>  handleEvent(createFakeWebkitMouseWheelEvent(-1, 0));
<a name="line238"></a>  assertMouseWheelEvent(1, 1, 0);
<a name="line239"></a>
<a name="line240"></a>  handleEvent(createFakeWebkitMouseWheelEvent(3, 0));
<a name="line241"></a>  assertMouseWheelEvent(-3, -3, 0);
<a name="line242"></a>
<a name="line243"></a>  handleEvent(createFakeWebkitMouseWheelEvent(0, 3));
<a name="line244"></a>  assertMouseWheelEvent(-3, 0, -3);
<a name="line245"></a>
<a name="line246"></a>  handleEvent(createFakeWebkitMouseWheelEvent(0, -1));
<a name="line247"></a>  assertMouseWheelEvent(1, 0, 1);
<a name="line248"></a>
<a name="line249"></a>  handleEvent(createFakeWebkitMouseWheelEvent(2, -1));
<a name="line250"></a>  assertMouseWheelEvent(-2, -2, 1);
<a name="line251"></a>}
<a name="line252"></a>
<a name="line253"></a>function testMaxDeltaX() {
<a name="line254"></a>  goog.userAgent = {
<a name="line255"></a>    OPERA: false,
<a name="line256"></a>    IE: false,
<a name="line257"></a>    GECKO: false,
<a name="line258"></a>    CAMINO: false,
<a name="line259"></a>    WEBKIT: true,
<a name="line260"></a>    WINDOWS: true
<a name="line261"></a>  };
<a name="line262"></a>
<a name="line263"></a>  createHandlerAndListen();
<a name="line264"></a>
<a name="line265"></a>  // IE-style Webkit events get wheelDelta divided by -40 to get detail.
<a name="line266"></a>  handleEvent(createFakeWebkitMouseWheelEvent(-120, 0));
<a name="line267"></a>  assertMouseWheelEvent(3, 3, 0);
<a name="line268"></a>
<a name="line269"></a>  mouseWheelHandler.setMaxDeltaX(3);
<a name="line270"></a>  mouseWheelHandlerRtl.setMaxDeltaX(3);
<a name="line271"></a>  handleEvent(createFakeWebkitMouseWheelEvent(-120, 0));
<a name="line272"></a>  assertMouseWheelEvent(3, 3, 0);
<a name="line273"></a>
<a name="line274"></a>  mouseWheelHandler.setMaxDeltaX(2);
<a name="line275"></a>  mouseWheelHandlerRtl.setMaxDeltaX(2);
<a name="line276"></a>  handleEvent(createFakeWebkitMouseWheelEvent(-120, 0));
<a name="line277"></a>  assertMouseWheelEvent(3, 2, 0);
<a name="line278"></a>
<a name="line279"></a>  handleEvent(createFakeWebkitMouseWheelEvent(0, -120));
<a name="line280"></a>  assertMouseWheelEvent(3, 0, 3);
<a name="line281"></a>}
<a name="line282"></a>
<a name="line283"></a>function testMaxDeltaY() {
<a name="line284"></a>  goog.userAgent = {
<a name="line285"></a>    OPERA: false,
<a name="line286"></a>    IE: false,
<a name="line287"></a>    GECKO: false,
<a name="line288"></a>    CAMINO: false,
<a name="line289"></a>    WEBKIT: true,
<a name="line290"></a>    WINDOWS: true
<a name="line291"></a>  };
<a name="line292"></a>
<a name="line293"></a>  createHandlerAndListen();
<a name="line294"></a>
<a name="line295"></a>  // IE-style Webkit events get wheelDelta divided by -40 to get detail.
<a name="line296"></a>  handleEvent(createFakeWebkitMouseWheelEvent(0, -120));
<a name="line297"></a>  assertMouseWheelEvent(3, 0, 3);
<a name="line298"></a>
<a name="line299"></a>  mouseWheelHandler.setMaxDeltaY(3);
<a name="line300"></a>  mouseWheelHandlerRtl.setMaxDeltaY(3);
<a name="line301"></a>  handleEvent(createFakeWebkitMouseWheelEvent(0, -120));
<a name="line302"></a>  assertMouseWheelEvent(3, 0, 3);
<a name="line303"></a>
<a name="line304"></a>  mouseWheelHandler.setMaxDeltaY(2);
<a name="line305"></a>  mouseWheelHandlerRtl.setMaxDeltaY(2);
<a name="line306"></a>  handleEvent(createFakeWebkitMouseWheelEvent(0, -120));
<a name="line307"></a>  assertMouseWheelEvent(3, 0, 2);
<a name="line308"></a>
<a name="line309"></a>  handleEvent(createFakeWebkitMouseWheelEvent(-120, 0));
<a name="line310"></a>  assertMouseWheelEvent(3, 3, 0);
<a name="line311"></a>}
<a name="line312"></a>
<a name="line313"></a>// Be sure to call this after setting up goog.userAgent mock and not before.
<a name="line314"></a>function createHandlerAndListen() {
<a name="line315"></a>  mouseWheelHandler = new goog.events.MouseWheelHandler(
<a name="line316"></a>      goog.dom.getElement(&#39;foo&#39;));
<a name="line317"></a>
<a name="line318"></a>  goog.events.listen(mouseWheelHandler,
<a name="line319"></a>      goog.events.MouseWheelHandler.EventType.MOUSEWHEEL,
<a name="line320"></a>      function(e) { mouseWheelEvent = e; });
<a name="line321"></a>
<a name="line322"></a>  mouseWheelHandlerRtl = new goog.events.MouseWheelHandler(
<a name="line323"></a>      goog.dom.getElement(&#39;fooRtl&#39;));
<a name="line324"></a>
<a name="line325"></a>  goog.events.listen(mouseWheelHandlerRtl,
<a name="line326"></a>      goog.events.MouseWheelHandler.EventType.MOUSEWHEEL,
<a name="line327"></a>      function(e) { mouseWheelEventRtl = e; });
<a name="line328"></a>}
<a name="line329"></a>
<a name="line330"></a>function handleEvent(event) {
<a name="line331"></a>  mouseWheelHandler.handleEvent(event);
<a name="line332"></a>  mouseWheelHandlerRtl.handleEvent(event);
<a name="line333"></a>}
<a name="line334"></a>
<a name="line335"></a>function assertMouseWheelEvent(expectedDetail, expectedDeltaX,
<a name="line336"></a>    expectedDeltaY) {
<a name="line337"></a>  assertTrue(&#39;event should be non-null&#39;, !!mouseWheelEvent);
<a name="line338"></a>  assertTrue(&#39;event should have correct JS type&#39;,
<a name="line339"></a>      mouseWheelEvent instanceof goog.events.MouseWheelEvent);
<a name="line340"></a>  assertEquals(&#39;event should have correct detail property&#39;,
<a name="line341"></a>      expectedDetail, mouseWheelEvent.detail);
<a name="line342"></a>  assertEquals(&#39;event should have correct deltaX property&#39;,
<a name="line343"></a>      expectedDeltaX, mouseWheelEvent.deltaX);
<a name="line344"></a>  assertEquals(&#39;event should have correct deltaY property&#39;,
<a name="line345"></a>      expectedDeltaY, mouseWheelEvent.deltaY);
<a name="line346"></a>
<a name="line347"></a>  // RTL
<a name="line348"></a>  assertTrue(&#39;event should be non-null&#39;, !!mouseWheelEventRtl);
<a name="line349"></a>  assertTrue(&#39;event should have correct JS type&#39;,
<a name="line350"></a>      mouseWheelEventRtl instanceof goog.events.MouseWheelEvent);
<a name="line351"></a>  assertEquals(&#39;event should have correct detail property&#39;,
<a name="line352"></a>      expectedDetail, mouseWheelEventRtl.detail);
<a name="line353"></a>  assertEquals(&#39;event should have correct deltaX property&#39;,
<a name="line354"></a>      -expectedDeltaX, mouseWheelEventRtl.deltaX);
<a name="line355"></a>  assertEquals(&#39;event should have correct deltaY property&#39;,
<a name="line356"></a>      expectedDeltaY, mouseWheelEventRtl.deltaY);
<a name="line357"></a>
<a name="line358"></a>}
<a name="line359"></a>
<a name="line360"></a>function createFakeMouseWheelEvent(type, opt_wheelDelta, opt_detail,
<a name="line361"></a>    opt_axis, opt_wheelDeltaX, opt_wheelDeltaY) {
<a name="line362"></a>  var event = {
<a name="line363"></a>    type: type,
<a name="line364"></a>    wheelDelta: goog.isDef(opt_wheelDelta) ? opt_wheelDelta : undefined,
<a name="line365"></a>    detail: goog.isDef(opt_detail) ? opt_detail : undefined,
<a name="line366"></a>    axis: opt_axis || undefined,
<a name="line367"></a>    wheelDeltaX: goog.isDef(opt_wheelDeltaX) ? opt_wheelDeltaX : undefined,
<a name="line368"></a>    wheelDeltaY: goog.isDef(opt_wheelDeltaY) ? opt_wheelDeltaY : undefined,
<a name="line369"></a>
<a name="line370"></a>    // These two are constants defined on the event in FF3.1 and later.
<a name="line371"></a>    // It doesn&#39;t matter exactly what they are, and it doesn&#39;t affect
<a name="line372"></a>    // our simulations of other browsers.
<a name="line373"></a>    HORIZONTAL_AXIS: HORIZONTAL,
<a name="line374"></a>    VERTICAL_AXIS: VERTICAL
<a name="line375"></a>  };
<a name="line376"></a>  return new goog.events.BrowserEvent(event);
<a name="line377"></a>}
<a name="line378"></a>
<a name="line379"></a>function createFakeWebkitMouseWheelEvent(wheelDeltaX, wheelDeltaY) {
<a name="line380"></a>  return createFakeMouseWheelEvent(DEFAULT_TYPE,
<a name="line381"></a>      Math.abs(wheelDeltaX) &gt; Math.abs(wheelDeltaY) ?
<a name="line382"></a>          wheelDeltaX : wheelDeltaY,
<a name="line383"></a>      undefined, undefined, wheelDeltaX, wheelDeltaY);
<a name="line384"></a>}
</pre>


</body>
</html>
